package com.aaa.mrcai.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @Author:Li-Yan-Chun
 * @Date:2021/12/2 16:44
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AjaxResult implements Serializable {
    private Integer code;
    private String msg;
    private Object data;

    public static AjaxResult success(){
        return new AjaxResult(1,"操作成功",null);
    }
    public static AjaxResult success(String msg){
        return new AjaxResult(1,msg,null);
    }
    public static AjaxResult success(Object data){
        return new AjaxResult(1,"操作成功",data);
    }
    public static AjaxResult defeated(){
        return new AjaxResult(2,"操作失败",null);
    }
    public static AjaxResult defeated(Object data){
        return new AjaxResult(2,"操作失败",data);
    }
    public static AjaxResult defeated(String msg){
        return new AjaxResult(2,msg,null);
    }



}
